package com.example.demodb.controller;

import com.example.demodb.entity.UserChat;
import com.example.demodb.service.UserChatService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class UserChatController {
    @Resource
    private UserChatService userChatService;

    @PostMapping("/UserChatController/findAllByAccountName")
    @CrossOrigin
    public List<UserChat> findAllByAccountName(@RequestParam("accountName") String accountName){
        return userChatService.findAllByAccountName(accountName);
    }

    @PostMapping("/UserChatController/addUserChat")
    @CrossOrigin
    public UserChat addUserChat(@RequestBody UserChat userChat){
        return userChatService.addUserChat(userChat);
    }


}
